package convert;

import dto.TargetDeptVO;
import dto.TreeNodeDTO;


/**
 * @date 2021/6/30
 */
public class EmpTreeNodeConvert {

    private EmpTreeNodeConvert() {}

    /**
     * dataSource 转变为 treeNode
     *
     * @param targetDeptVO
     * @return
     */
    public static TreeNodeDTO convertEmployee(TargetDeptVO targetDeptVO) {
        TreeNodeDTO treeNode = new TreeNodeDTO();

        treeNode.setTitle(targetDeptVO.getDepartmentName());
        if("BD".equals(targetDeptVO.getRole())){
            treeNode.setKey("-1");
        }else {
            treeNode.setKey(targetDeptVO.getDepartmentId());
        }
        treeNode.setParentKey(targetDeptVO.getParentId());
        treeNode.setSort(Integer.MAX_VALUE);
//        Map<String, String> props = BeanMapUtils.beanToMapNew(targetDeptVO, Lists.newArrayList("bds"));
//        treeNode.getProps().putAll(props);
        return treeNode;
    }
}
